#include <iostream>
using namespace std;
#define gua(i,a,b) for(int i=(a);i<=(b);++i)
int n,now,ans;
int main(){
	cin>>n;
	gua(i,1,n){
		int x;cin>>x;
		if(x==0)now+=3;
		else if(x==1)now+=1;
		else if(x==2)now+=2;
		now%=4;
		if(now==3)++ans;
	}
	cout<<ans<<endl;
	return 0;
}
